import React from 'react';
import { message, Popconfirm } from 'antd';
const confirm = (e) => {
  console.log(e);
  message.success('Click on Yes');
};
const cancel = (e) => {
  console.log(e);
  message.error('Click on No');
};
const MyPopconfirm = () => (
  <Popconfirm

    // 第一种写法可以
    // getPopupContainer={node => {
    //   if (node) {
    //     return node.parentNode;
    //   }
    //   return document.body;
    // }}

    // 第二种写法也可以(其实两个都一样)
    // getPopupContainer={triggerNode => triggerNode.parentNode }

    // 这种写法也可以(为什么会有第三种写法，因为ts中上面两种报错了，报错我也看不太懂) 
    // getPopupContainer={(triggerNode) => triggerNode} 

    title="Are you sure to delete this task?"
    onConfirm={confirm}
    onCancel={cancel}
    okText="Yes"
    cancelText="No"
  >
    <a href="#">Delete</a>
  </Popconfirm>
);
export default MyPopconfirm;